/**
 * 
 */

package com.pp.admin.common.client.helper;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author pandurang
 */
public class AdminHorizontalPanel extends HorizontalPanel {

	private static final String verticalLineBgColor = "#92C1F0";

	public void setCellAttribute(Widget w, String attribute, String value) {

		Element td = getWidgetTd(w);
		if (td != null) {
			td.setAttribute(attribute, value);
		}
	}

	Element getWidgetTd(final Widget w) {

		if (w.getParent() != this) {
			return null;
		}
		return DOM.getParent(w.getElement());
	}

	public void addVerticalLine() {

		HTML verticalLine1 = new HTML("<br>");
		this.add(verticalLine1);
		this.setCellWidth(verticalLine1, "2");
		this.setCellAttribute(verticalLine1, "bgcolor", verticalLineBgColor);
		this.setSpacing(5);

	}
}
